/**
 * Copyright (C), 2021-2023, 四信物联网有限公司
 * FileName: BDicpMessageHandler
 * Author:   Chapin
 * Date:     2023/10/20 17:53
 * Description: ICP消息处理
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.fourfaith.iot.beidou.handler;

import com.fourfaith.iot.beidou.decodec.BeiDouContants;
import com.fourfaith.iot.beidou.message.inbound.BDfkiMessage;
import com.fourfaith.iot.beidou.session.SessionFactory;
import com.fourfaith.iot.beidou.utils.MessageParseUtil;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;

/**
 * 〈FKI消息处理〉
 * @author Chapin
 * @create 2023/10/20
 * @since 1.0.0
 */
@Slf4j
@ChannelHandler.Sharable
public class BDfkiMessageHandler extends SimpleChannelInboundHandler<BDfkiMessage> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, BDfkiMessage msg) throws Exception {
        // 报文发送状态处理
        SessionFactory.getSession().setAttribute(ctx.channel(), BeiDouContants.FKI, msg);
        MessageParseUtil.setSendResult(msg);
    }
}